package fourfaith.com.ff_sl21_app.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;

public class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
	private ArrayList<Fragment> mFragmentList = null;

	public MyFragmentPagerAdapter(FragmentManager mFragmentManager, ArrayList<Fragment> fragmentList)
	{
		super(mFragmentManager);
		this.mFragmentList = fragmentList;
	}

	public int getCount()
	{
		return this.mFragmentList.size();
	}

	public Fragment getItem(int position)
	{
		Fragment fragment = null;
		if (position < this.mFragmentList.size())
			fragment = (Fragment)this.mFragmentList.get(position);
		else {
			fragment = (Fragment)this.mFragmentList.get(0);
		}
		return fragment;
	}
}
